home *** CD-ROM | disk | FTP | other *** search
- Path: CS.Arizona.EDU!not-for-mail
- From: kdb@CS.Arizona.EDU (Koen De Bosschere)
- Newsgroups: comp.lang.c++
- Subject: mutual data structures
- Date: 23 Mar 1996 13:28:49 -0700
- Organization: University of Arizona CS Department, Tucson AZ
- Message-ID: <4j1mu1$fas@baskerville.CS.Arizona.EDU>
- NNTP-Posting-Host: baskerville.cs.arizona.edu
-
- I am trying to create a data structure consisting of
- two linked lists, with nodes pointing at each other
- between the two lists.
-
- The problem is that in order to create typed pointers, I
- need the definition of the class, and no matter how I reorder
- the class definitions, there will always be an undefined
- class at some point.
-
- class node1 {
- ....
- node2 *pointer; // node2 undefined at this point
- ....
- };
-
- class node2 {
- ....
- node1 *pointer;
- ....
- };
-
- I was wondering whether there is an elegant solution
- for this kind of problem. This kind of data structure
- cannot be so unusual, so other people must have faced
- this problem before.
-
- Thanks
-
- -- Koen De Bosschere
-